﻿using System;

namespace OnlineBookstore
{
    class Program
    {
        static void Main(string[] args)
        {
            cl_0423_MySubject subject = new cl_0423_BookStore();
            cl_0423_MyObserver ob1, ob2;
            cl_0423_UsersAccount user1, user2;
            user1=new cl_0423_UsersAccount("小明");
            user2 = new cl_0423_UsersAccount("小红");
            ob1 = user1;
            ob2 = user2;
            subject.attach(ob1);
            subject.attach(ob2);
            subject.active();
            Console.WriteLine("");
            Console.WriteLine("********************");
            Console.WriteLine("");
            user1.BuyBook(100);
            Console.WriteLine("————————");
            user1.ChangeCredit();
            Console.WriteLine("————————");
            user1.BuyBook(130);
            user1.CalcRealAmount();
            Console.WriteLine("————————");
            user1.ChangeCredit();
            Console.WriteLine("");

            Console.WriteLine("********************");
            Console.WriteLine("");
            user2.BuyBook(150);
            Console.WriteLine("————————");
            user2.ChangeCredit();
            Console.WriteLine("————————");
            user2.BuyBook(400);
            user2.CalcRealAmount();
            Console.WriteLine("————————");
            user2.ChangeCredit();

            Console.ReadKey();
        }
    }
}
